package com.trkj.property_controller;

import com.trkj.entity.CarParkingHousemanageYardEntity;
import com.trkj.entity.CarspacesEntity;
import com.trkj.entity.ParkingEntity;
import com.trkj.entity.HouseEntity;
import com.trkj.entity.ParkingEntity;
import com.trkj.service.ParkingService;
import com.trkj.vo.AjaxResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping("/Parking")
public class ParkingController {
    @Resource
    private ParkingService parkingService;

    @PostMapping("selectAll")
    public AjaxResponse selectAll(ParkingEntity parkingEntity, int currentPage, int pageSize){
        return AjaxResponse.success(parkingService.selectAll(parkingEntity,currentPage,pageSize));
    }

    @GetMapping("HousfindAll")
    public AjaxResponse HousfindAll(){
        return AjaxResponse.success(parkingService.HousfindAll());
    }

    @PostMapping("/addCarspaces")
    public AjaxResponse addCarspaces(@RequestBody CarspacesEntity carspacesEntity) {
        Integer generatedId = parkingService.addCarspaces(carspacesEntity);
        return AjaxResponse.success(generatedId);
    }

    @GetMapping("/selectMaxid")
    public AjaxResponse selectMaxid(){
        return AjaxResponse.success(parkingService.selectMaxid());
    }

    @PostMapping("/addCarParkingHousemanageYard")
    public AjaxResponse addCarParkingHousemanageYard(@RequestBody CarParkingHousemanageYardEntity carParkingHousemanageYardEntity){
        return AjaxResponse.success(parkingService.addCarParkingHousemanageYard(carParkingHousemanageYardEntity));
    }



}
